package game.common.world;


public class VectorImpl implements Vector {
	private int dir,
				speed;
	
	private Point point;
	
	/**
	 * clones the point
	 * @param v
	 */
	public VectorImpl(Vector v) {
		this.point = new PointImpl(v);
		this.dir = v.getDir();
		this.speed = v.getSpeed();
	}
	
	/**
	 * keeps the point reference
	 * 
	 * @param p
	 * @param dir
	 * @param speed
	 */
	public VectorImpl(Point p, int dir, int speed) {
		this.point = p;
		this.dir = dir;
		this.speed = speed;
	}
	
	@Override
	public void copy(Point p) {
		this.point.copy(p);
	}
	
	@Override
	public void copy(Vector v) {
		this.point.copy(v);
		this.dir = v.getDir();
		this.speed = v.getSpeed();
	}
	
	public float getXf() {
		return point.getXf();
	}
	public float getYf() {
		return point.getYf();
	}
	public float getZf() {
		return point.getZf();
	}
	public void setX(float x) {
		point.setX(x);
	}
	public void setY(float y) {
		point.setY(y);
	}
	public void setZ(float z) {
		point.setZ(z);
	}
	public int getDir() {
		return dir;
	}
	public void setDir(int dir) {
		this.dir = dir;
	}
	public int getSpeed() {
		return speed;
	}
	public void setSpeed(int speed) {
		this.speed = speed;
	}
	public Point getPoint() {
		return point;
	}
	public void setPoint(Point point) {
		this.point = point;
	}
	
	public String toString(){
		return new StringBuilder(point.toString()).append(",dir: ").append(getDir()).append(",speed:").append(getSpeed()).toString();
	}
}
